package com.android.cl.coludtf.appcliation;

import android.app.Application;
import android.content.Context;

import java.util.logging.Handler;
import java.util.logging.LogRecord;

public class MyAppcliation extends Application {

//在整个应用执行的过程中，需要提供的变量

    public static Context context;//需要使用的上下文对象

    public static Handler handler;//需要使用的Handler

    public static Thread mainThread;//提供主线程对象

    public static int mainThreadId;//提供主线程对象的Id

    @Override
    public void onCreate() {
        super.onCreate();
        context = this.getApplicationContext();
        mainThread = Thread.currentThread();//实例化Application当前的线程为主线程
        mainThreadId = android.os.Process.myTid();//获取当前线程的Id

        handler = new Handler() {
            @Override
            public void publish(LogRecord record) {

            }

            @Override
            public void flush() {

            }

            @Override
            public void close() throws SecurityException {

            }
        };
    }

}


